import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooGroupHasPermissionController } from '../../../controllers';
const uctoogroupHasPermissionRouter = new Router();
const groupHasPermissionController = new uctooGroupHasPermissionController();

uctoogroupHasPermissionRouter.post('/add', requireUser, groupHasPermissionController.add);
uctoogroupHasPermissionRouter.post('/edit', requireUser, rowLevelPermission('uctoo/group_has_permission'), groupHasPermissionController.edit);
uctoogroupHasPermissionRouter.post('/del', requireUser, rowLevelPermission('uctoo/group_has_permission'), groupHasPermissionController.delete);

//For getting groupHasPermission with permission control
uctoogroupHasPermissionRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/group_has_permission'), groupHasPermissionController.getSingle);
uctoogroupHasPermissionRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/group_has_permission'), groupHasPermissionController.getMany);
uctoogroupHasPermissionRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/group_has_permission'), groupHasPermissionController.getMany);

//#endregion AutoCreateCode
uctoogroupHasPermissionRouter.post('/connect', requireUser, groupHasPermissionController.connect);
uctoogroupHasPermissionRouter.post('/connectChecked', requireUser, groupHasPermissionController.connectChecked);
export default uctoogroupHasPermissionRouter;
